1 //+------------------------------------------------------------------+
\r
2 //| RAVI FX Fisher.mq4 |
\r
3 //| Copyright © 2005, Luis Guilherme Damiani |
\r
4 //| http://www.damianifx.com.br |
\r
5 //+------------------------------------------------------------------+
\r
6 #property copyright "Copyright © 2005, Luis Guilherme Damiani"
\r
7 #property link "http://www.damianifx.com.br"
\r
9 #property indicator_separate_window
\r
10 #property indicator_buffers 3
\r
11 #property indicator_color1 Lime
\r
12 #property indicator_color2 Red
\r
13 #property indicator_color3 Yellow
\r
15 //---- input parameters
\r
16 extern int lenth=10;
\r
17 extern int maxbars=2000;
\r
21 double FishBuffer[];
\r
22 double SignalBuffer[];
\r
25 //+------------------------------------------------------------------+
\r
26 //| Custom indicator initialization function |
\r
27 //+------------------------------------------------------------------+
\r
31 SetIndexStyle(0,DRAW_LINE);
\r
32 SetIndexBuffer(0,FishBuffer);
\r
33 SetIndexStyle(1,DRAW_LINE);
\r
34 SetIndexBuffer(1,SignalBuffer);
\r
35 SetIndexStyle(2,DRAW_LINE);
\r
36 SetIndexBuffer(2,AuxBuffer);
\r
37 SetLevelValue(0,0.8);
\r
38 SetLevelValue(1,-0.8);
\r
39 ArrayInitialize(FishBuffer,0);
\r
40 ArrayInitialize(SignalBuffer,0);
\r
41 ArrayInitialize(AuxBuffer,0);
\r
45 //+------------------------------------------------------------------+
\r
46 //| Custor indicator deinitialization function |
\r
47 //+------------------------------------------------------------------+
\r
55 //+------------------------------------------------------------------+
\r
56 //| Custom indicator iteration function |
\r
57 //+------------------------------------------------------------------+
\r
61 int counted_bars=IndicatorCounted();
\r
62 Comment(Bars," ", counted_bars);
\r
63 //double Normalized=0;
\r
65 //---- check for possible errors
\r
66 if(counted_bars<0) return(-1);
\r
67 int limit=Bars-counted_bars;
\r
68 if(limit>maxbars)limit=maxbars;
\r
69 if (limit>Bars-lenth-1)limit=Bars-lenth-1;
\r
71 for (int shift = limit; shift>=0;shift--)
\r
73 AuxBuffer[shift]=0.5*(iStochastic(NULL,0,lenth,2,1,MODE_SMA,0,MODE_MAIN,shift)/100-0.5)*2+0.5*AuxBuffer[shift+1];
\r
75 FishBuffer[shift]= 0.25* MathLog((1+AuxBuffer[shift])/(1-AuxBuffer[shift]))+0.5*FishBuffer[shift+1];
\r
76 SignalBuffer[shift]=FishBuffer[shift+1];
\r
83 //+------------------------------------------------------------------+